<script setup lang="ts">
import {reactive} from "vue";
import {submitAdmit} from "@/api/admit";
import {ElMessage} from "element-plus";

const route = useRoute()
const admitForm = reactive({
  student_id:'', // 学生id
  luqu_status: 0, // 录取状态 0 未录取 1已录取
  tracking_code: '', // 录取快递单号
  luqu_time: '' // 录取时间
})

let subLoading = ref(false)

const handleSubmit = async () => {
  let res = await submitAdmit(admitForm)
  if (res){
    ElMessage({message: '提交成功', type: 'success'})
  }
}

defineExpose({admitForm})

</script>

<template>
  <el-form label-position="left" label-width="85px">
    <el-row justify="center">
      <el-col :lg="22" :xl="19" :xs="24" :md="24" :sm="24" class="box-wrap">
        <div class="student-label">录取信息</div>
        <el-row style="justify-content: space-between;">
          <el-col :lg="5" :xs="24" :md="7" :sm="24">
            <el-form-item label="录取状态" prop="luqu_status">
              <el-radio-group v-model="admitForm.luqu_status">
                <el-radio :label="0">未录取</el-radio>
                <el-radio :label="1">已录取</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :lg="5" :xs="24" :md="7" :sm="24">
            <el-form-item label="录取时间" prop="luqu_status">
              <el-date-picker
                  v-model="admitForm.luqu_time"
                  type="date"
                  placeholder="请选择下次录取时间" format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD"/>
            </el-form-item>
          </el-col>
          <el-col :lg="5" :xs="24" :md="7" :sm="24">
            <el-form-item label="通知书快递" prop="luqu_status">
              <el-input v-model="admitForm.tracking_code" placeholder="请输入通知书快递号"/>
            </el-form-item>
          </el-col>
          <el-col :lg="5" :xs="24" :md="7" :sm="24"></el-col>
          <el-col :lg="22" :xs="24" :md="24" :sm="24">
            <el-form-item prop="teacher">
              <el-button type="primary" plain @click="handleSubmit" :loading="subLoading">提交录取信息</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
  </el-form>
</template>

<style scoped lang="less">
@import "../index";
</style>